from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        CREATE TABLE IF NOT EXISTS `admin_api` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `path` VARCHAR(100) NOT NULL  COMMENT 'API路径',
    `method` VARCHAR(6) NOT NULL  COMMENT '请求方法',
    `summary` VARCHAR(500) NOT NULL  COMMENT '请求简介',
    `tags` VARCHAR(100) NOT NULL  COMMENT 'API标签',
    KEY `idx_admin_api_created_619b3f` (`created_at`),
    KEY `idx_admin_api_updated_bfa461` (`updated_at`),
    KEY `idx_admin_api_path_6d2a06` (`path`),
    KEY `idx_admin_api_method_e8ce2b` (`method`),
    KEY `idx_admin_api_summary_ff7e21` (`summary`),
    KEY `idx_admin_api_tags_da7ee8` (`tags`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `appointment_category` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(255)   COMMENT '项目分类名称',
    `desc` VARCHAR(500)   COMMENT '备注',
    `is_deleted` BOOL NOT NULL  COMMENT '软删除标记' DEFAULT 0,
    `order` INT NOT NULL  COMMENT '排序' DEFAULT 0,
    `parent_id` INT NOT NULL  COMMENT '父分类ID' DEFAULT 0,
    `cover` VARCHAR(255)   COMMENT '封面',
    `goods_id` INT NOT NULL  COMMENT '关联商品id' DEFAULT 0,
    `sku_id` INT NOT NULL  COMMENT '关联规格id' DEFAULT 0,
    KEY `idx_appointment_created_56d8a2` (`created_at`),
    KEY `idx_appointment_updated_c06c33` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `appointment_designer` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `sort` INT NOT NULL  COMMENT '排序' DEFAULT 0,
    `name` VARCHAR(255) NOT NULL  COMMENT '对象名称',
    `space_id` JSON   COMMENT '多选,门店id',
    `type` INT NOT NULL  COMMENT '对象类型1助理2美学设计3医生' DEFAULT 0,
    `doctor_type` JSON   COMMENT '医生类型[微美，皮肤，口腔，私密，中医]',
    `title` VARCHAR(255) NOT NULL  COMMENT '称号',
    `intro` VARCHAR(255)   COMMENT '简介',
    `picture` VARCHAR(255)   COMMENT '头像地址',
    `images` JSON   COMMENT '组图',
    `status` BOOL NOT NULL  COMMENT '状态 0：未开通，1：开通' DEFAULT 1,
    `open_roles` JSON   COMMENT '开放规则',
    `close_roles` JSON   COMMENT '关闭规则',
    `project_roles` JSON   COMMENT '项目规则',
    KEY `idx_appointment_created_361a39` (`created_at`),
    KEY `idx_appointment_updated_f37e89` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `appointment_instrument` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `space_id` INT NOT NULL  COMMENT '门店id' DEFAULT 0,
    `instrument_id` INT NOT NULL  COMMENT '仪器id' DEFAULT 0,
    `interval` INT NOT NULL  COMMENT '间隔' DEFAULT 30,
    `num` INT NOT NULL  COMMENT '数量' DEFAULT 1,
    `date` JSON   COMMENT '可预约日期',
    KEY `idx_appointment_created_05f9c0` (`created_at`),
    KEY `idx_appointment_updated_07038d` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `appointment_list` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `type` INT NOT NULL  COMMENT '预约大类' DEFAULT 1,
    `d_type` INT NOT NULL  COMMENT '预约子类' DEFAULT 1,
    `time` DATETIME(6)   COMMENT '预约时间',
    `city_id` INT NOT NULL  COMMENT '城市id' DEFAULT 1,
    `space_id` INT NOT NULL  COMMENT '门店id' DEFAULT 1,
    `designer_ids` JSON   COMMENT '技师ids',
    `designer_names` JSON   COMMENT '技师ids',
    `project_id` INT   COMMENT '项目id' DEFAULT 0,
    `project_name` VARCHAR(255)   COMMENT '项目名称',
    `ex_project_ids` JSON   COMMENT '搭配项目id',
    `ex_project_names` JSON   COMMENT '搭配项目名称',
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `user_name` VARCHAR(255) NOT NULL  COMMENT '用户名称',
    `user_card_no` INT NOT NULL  COMMENT '用户卡号' DEFAULT 0,
    `user_type` INT NOT NULL  COMMENT '用户等级' DEFAULT 0,
    `user_phone` VARCHAR(255)   COMMENT '用户联系方式',
    `come_nums` INT NOT NULL  COMMENT '预约人数' DEFAULT 1,
    `cancel_time` DATETIME(6)   COMMENT '取消预约时间',
    `status` INT NOT NULL  COMMENT '2:未通过,3：已取消，0：待确认，1：通过' DEFAULT 0,
    `extend` JSON   COMMENT '附加信息',
    `order_id` INT NOT NULL  COMMENT '订单id' DEFAULT 0,
    `longs` INT NOT NULL  COMMENT '操作时长(分钟)' DEFAULT 0,
    KEY `idx_appointment_created_882e61` (`created_at`),
    KEY `idx_appointment_updated_9a8ab5` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `appointment_lock` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户ID' DEFAULT 0,
    `designer_ids` JSON NOT NULL  COMMENT '技师IDs',
    `time` DATETIME(6)   COMMENT '预约时间',
    `longs` INT NOT NULL  COMMENT '操作时长' DEFAULT 0,
    KEY `idx_appointment_created_796be9` (`created_at`),
    KEY `idx_appointment_updated_22bfc2` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `appointment_project` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `sort` INT NOT NULL  COMMENT '排序' DEFAULT 0,
    `pid` INT NOT NULL  COMMENT '关联仪器id' DEFAULT 0,
    `name` VARCHAR(255) NOT NULL  COMMENT '项目名称',
    `type` INT NOT NULL  COMMENT '类别' DEFAULT 0,
    `online` BOOL NOT NULL  COMMENT '是否需要线上预约' DEFAULT 1,
    `status` BOOL NOT NULL  COMMENT '状态 0：未开通，1：开通' DEFAULT 1,
    `interval` INT NOT NULL  COMMENT '时长' DEFAULT 0,
    `goods_id` INT NOT NULL  COMMENT '关联商品id' DEFAULT 0,
    `sku_id` INT NOT NULL  COMMENT '关联规格id' DEFAULT 0,
    `cover` VARCHAR(255)   COMMENT '封面',
    `project_images` JSON   COMMENT '详情组图',
    KEY `idx_appointment_created_2a1cef` (`created_at`),
    KEY `idx_appointment_updated_6ded46` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `appointment_salon` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `sort` INT NOT NULL  COMMENT '排序' DEFAULT 0,
    `role_id` JSON   COMMENT '可以预约的角色类型,多选',
    `kind` INT NOT NULL  COMMENT '1：内部沙龙，2：外部沙龙' DEFAULT 1,
    `type_id` INT NOT NULL  COMMENT '1：会员沙龙，2：微美沙龙' DEFAULT 1,
    `is_brand` BOOL NOT NULL  COMMENT '是否是品牌联名' DEFAULT 1,
    `name` VARCHAR(255) NOT NULL  COMMENT '沙龙名称',
    `english_name` VARCHAR(255) NOT NULL  COMMENT '沙龙英文名称',
    `desc` VARCHAR(255) NOT NULL  COMMENT '描述',
    `picture` VARCHAR(255) NOT NULL  COMMENT '封面',
    `content_pic` JSON   COMMENT '组图',
    `start_time` DATETIME(6)   COMMENT '门店开始预约时间',
    `end_time` DATETIME(6)   COMMENT '门店结束预约时间',
    `date` DATETIME(6)   COMMENT '举办日期',
    `city_id` INT NOT NULL  COMMENT '城市id' DEFAULT 0,
    `space_id` INT NOT NULL  COMMENT '门店id' DEFAULT 0,
    `location` VARCHAR(255) NOT NULL  COMMENT '举办地址',
    `number` INT NOT NULL  COMMENT '人数' DEFAULT 0,
    `is_accompany` BOOL NOT NULL  COMMENT '是否可带人' DEFAULT 1,
    `show_add` INT NOT NULL  COMMENT '显示增加人数' DEFAULT 0,
    `number_have` INT NOT NULL  COMMENT '实际报名人数' DEFAULT 0,
    `times` BOOL NOT NULL  COMMENT '是否控制每月次数' DEFAULT 1,
    `status` BOOL NOT NULL  COMMENT '状态 0：未开通，1：开通' DEFAULT 1,
    `need_parking` BOOL NOT NULL  COMMENT '是否需要泊车' DEFAULT 1,
    `parking_price` INT NOT NULL  COMMENT '泊车单价' DEFAULT 0,
    KEY `idx_appointment_created_6da19a` (`created_at`),
    KEY `idx_appointment_updated_343e63` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `appointment_space` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `sort` INT NOT NULL  COMMENT '排序' DEFAULT 0,
    `city_id` INT NOT NULL  COMMENT '城市id' DEFAULT 1,
    `type` INT NOT NULL  COMMENT '门店类型 1 实体 2 虚拟' DEFAULT 1,
    `name` VARCHAR(255) NOT NULL  COMMENT '门店名称',
    `english_name` VARCHAR(255) NOT NULL  COMMENT '门店英文名称',
    `intro` VARCHAR(255) NOT NULL  COMMENT '简介',
    `phone` VARCHAR(255) NOT NULL  COMMENT '联系电话',
    `address` VARCHAR(255) NOT NULL  COMMENT '详细地址',
    `date` JSON   COMMENT '可预约日期',
    `interval` INT NOT NULL  COMMENT '时间段间隔' DEFAULT 30,
    `start` VARCHAR(255) NOT NULL  COMMENT '门店开始预约时间',
    `end` VARCHAR(255) NOT NULL  COMMENT '门店结束预约时间',
    `slot` JSON   COMMENT '可预约日期的时间段',
    `parking_on` BOOL NOT NULL  COMMENT '是否开启预约停车信息填写' DEFAULT 1,
    `parking_cost` INT NOT NULL  COMMENT '停车费 元/小时' DEFAULT 0,
    `project_appointment` BOOL NOT NULL  COMMENT '是否可以项目预约' DEFAULT 1,
    `status` BOOL NOT NULL  COMMENT '状态 0：未开通，1：开通' DEFAULT 1,
    `picture` VARCHAR(255) NOT NULL  COMMENT '封面',
    `images` JSON   COMMENT '详情组图',
    `content_pic` JSON   COMMENT '图文介绍',
    `project_roles` JSON   COMMENT '项目规则',
    `lat` VARCHAR(255) NOT NULL  COMMENT '经度',
    `lon` VARCHAR(255) NOT NULL  COMMENT '纬度',
    KEY `idx_appointment_created_211cf6` (`created_at`),
    KEY `idx_appointment_updated_4793a2` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `admin_auditlog` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户ID',
    `username` VARCHAR(64) NOT NULL  COMMENT '用户名称' DEFAULT '',
    `module` VARCHAR(64) NOT NULL  COMMENT '功能模块' DEFAULT '',
    `summary` VARCHAR(128) NOT NULL  COMMENT '请求描述' DEFAULT '',
    `method` VARCHAR(10) NOT NULL  COMMENT '请求方法' DEFAULT '',
    `path` VARCHAR(255) NOT NULL  COMMENT '请求路径' DEFAULT '',
    `status` INT NOT NULL  COMMENT '状态码' DEFAULT -1,
    `response_time` INT NOT NULL  COMMENT '响应时间(单位ms)' DEFAULT 0,
    `datas` JSON   COMMENT '提交数据',
    KEY `idx_admin_audit_created_a8e9d5` (`created_at`),
    KEY `idx_admin_audit_updated_f02ec6` (`updated_at`),
    KEY `idx_admin_audit_user_id_76f7a2` (`user_id`),
    KEY `idx_admin_audit_usernam_75fb48` (`username`),
    KEY `idx_admin_audit_module_20c766` (`module`),
    KEY `idx_admin_audit_summary_283973` (`summary`),
    KEY `idx_admin_audit_method_4cdc16` (`method`),
    KEY `idx_admin_audit_path_0b6d7f` (`path`),
    KEY `idx_admin_audit_status_bbab09` (`status`),
    KEY `idx_admin_audit_respons_1303a0` (`response_time`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `saas_buckling` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `order_id` INT NOT NULL  COMMENT '订单id' DEFAULT 0,
    `goods_id` INT NOT NULL  COMMENT '商品id' DEFAULT 0,
    `sku_id` INT NOT NULL  COMMENT '规格id' DEFAULT 0,
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `nums` INT NOT NULL  COMMENT '数量' DEFAULT 0,
    `direction` INT NOT NULL  COMMENT '变动方向1增加2减少' DEFAULT 1,
    `add_uid` INT NOT NULL  COMMENT '录入人id' DEFAULT 0,
    `space_id` INT NOT NULL  COMMENT '门店id' DEFAULT 0,
    `use_nums` INT NOT NULL  COMMENT '使用次数' DEFAULT 0,
    `last_nums` INT NOT NULL  COMMENT '剩余次数' DEFAULT 0,
    `price` DECIMAL(10,2) NOT NULL  COMMENT '划扣总金额',
    `todo_id` INT NOT NULL  COMMENT 'todo_id' DEFAULT 0,
    `over_date` DATE   COMMENT '超期时间',
    `group_id` INT NOT NULL  COMMENT 'saas_buckling_group表id' DEFAULT 0,
    KEY `idx_saas_buckli_created_3dcf3b` (`created_at`),
    KEY `idx_saas_buckli_updated_c2e66c` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `saas_buckling_detail` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `buckling_id` INT NOT NULL  COMMENT 'buckling_id' DEFAULT 0,
    `cases_id` INT NOT NULL  COMMENT '病例id' DEFAULT 0,
    `nums` INT NOT NULL  COMMENT '数量' DEFAULT 0,
    `buckling_price` DECIMAL(10,2) NOT NULL  COMMENT '划扣金额',
    KEY `idx_saas_buckli_created_3445ec` (`created_at`),
    KEY `idx_saas_buckli_updated_ed26b7` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `saas_buckling_group` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `type` INT NOT NULL  COMMENT '1必得2选择' DEFAULT 1,
    `todo_id` INT NOT NULL  COMMENT 'BucklingTodo表的id' DEFAULT 0,
    `group_id` INT NOT NULL  COMMENT '组合包id' DEFAULT 0,
    `group_name` VARCHAR(255)   COMMENT '组合包名称',
    `group_type` INT NOT NULL  COMMENT '类型1分次2总次3时段' DEFAULT 0,
    `times` INT NOT NULL  COMMENT '总次数/时长' DEFAULT 0,
    `over_date` DATE   COMMENT '超期时间',
    `use_times` INT NOT NULL  COMMENT '使用次数' DEFAULT 0,
    `last_times` INT NOT NULL  COMMENT '剩余次数' DEFAULT 0,
    KEY `idx_saas_buckli_created_3bc2b7` (`created_at`),
    KEY `idx_saas_buckli_updated_8a0af9` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `saas_buckling_todo` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `order_id` INT NOT NULL  COMMENT '订单id' DEFAULT 0,
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `goods_id` INT NOT NULL  COMMENT '商品id' DEFAULT 0,
    `sku_id` INT NOT NULL  COMMENT 'sku_id' DEFAULT 0,
    `project_id` INT NOT NULL  COMMENT '项目id' DEFAULT 0,
    `type` INT NOT NULL  COMMENT '1项目2套餐卡' DEFAULT 1,
    `status` INT NOT NULL  COMMENT '0未开卡1疗程中2已结束' DEFAULT 0,
    `price` INT NOT NULL  COMMENT '划分价值' DEFAULT 0,
    `nums` INT NOT NULL  COMMENT '数量' DEFAULT 1,
    `order_goods_id` INT NOT NULL  COMMENT 'order_goods表的id' DEFAULT 0,
    `start_date` DATE   COMMENT '开卡时间',
    `start_space` INT   COMMENT '开卡门店' DEFAULT 0,
    KEY `idx_saas_buckli_created_c2d1b9` (`created_at`),
    KEY `idx_saas_buckli_updated_d104e8` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `saas_cases` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `add_uid` INT NOT NULL  COMMENT '录入人id' DEFAULT 0,
    `space_id` INT NOT NULL  COMMENT '门店id' DEFAULT 0,
    `desc` VARCHAR(255) NOT NULL  COMMENT '备注',
    `files` JSON   COMMENT '关联凭证',
    `designer_ids` JSON   COMMENT '技师ids',
    `buckling_data` JSON   COMMENT '明细',
    `buckling_consumables` JSON   COMMENT '划扣耗材明细',
    `e_sign` VARCHAR(255)   COMMENT '电子签名',
    `other_form` JSON   COMMENT '其他表单',
    `before_pic` JSON   COMMENT '术前图片',
    `after_pic` JSON   COMMENT '术后图片',
    KEY `idx_saas_cases_created_ae5e7c` (`created_at`),
    KEY `idx_saas_cases_updated_678700` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `checkin_list` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `checkin_time` DATETIME(6)   COMMENT '签到时间',
    KEY `idx_checkin_lis_created_827509` (`created_at`),
    KEY `idx_checkin_lis_updated_c6cec5` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `marketing_commission` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `orders_id` INT NOT NULL  COMMENT '订单id' DEFAULT 0,
    `orders_goods_id` INT   COMMENT 'orders_goods表id' DEFAULT 0,
    `goods_id` INT   COMMENT '商品id' DEFAULT 0,
    `grow_id` INT   COMMENT '培育模板id' DEFAULT 0,
    `goods_price` DECIMAL(10,2)   COMMENT '商品金额',
    `orders_user_id` INT   COMMENT '用户id' DEFAULT 0,
    `user_id` INT   COMMENT '收益用户id' DEFAULT 0,
    `user_level` INT   COMMENT '收益用户等级' DEFAULT 0,
    `level` INT   COMMENT '收益层级[1直接,2间接,3...]' DEFAULT 0,
    `price` DECIMAL(10,2)   COMMENT '收益金额',
    `status` INT   COMMENT '0待审核1已审核' DEFAULT 0,
    KEY `idx_marketing_c_created_dbc062` (`created_at`),
    KEY `idx_marketing_c_updated_381996` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `saas_consumables` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` LONGTEXT   COMMENT '耗材名称',
    `guige` LONGTEXT NOT NULL  COMMENT '规格',
    `danwei` LONGTEXT NOT NULL  COMMENT '单位',
    `order` INT NOT NULL  COMMENT '排序' DEFAULT 0,
    `type` INT NOT NULL  COMMENT '类型' DEFAULT 1,
    KEY `idx_saas_consum_created_7194bd` (`created_at`),
    KEY `idx_saas_consum_updated_f37077` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `saas_consumables_use` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `consumables_id` INT NOT NULL  COMMENT '耗材id' DEFAULT 0,
    `nums` DECIMAL(10,2) NOT NULL  COMMENT '耗材使用数量',
    `cases_id` INT NOT NULL  COMMENT '病例id' DEFAULT 0,
    KEY `idx_saas_consum_created_2da98a` (`created_at`),
    KEY `idx_saas_consum_updated_36d081` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `content_category` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(20) NOT NULL  COMMENT '分类名称',
    `desc` VARCHAR(500)   COMMENT '备注',
    `is_deleted` BOOL NOT NULL  COMMENT '软删除标记' DEFAULT 0,
    `order` INT NOT NULL  COMMENT '排序' DEFAULT 0,
    `parent_id` INT NOT NULL  COMMENT '父分类ID' DEFAULT 0,
    KEY `idx_content_cat_created_8713ae` (`created_at`),
    KEY `idx_content_cat_updated_25cbf9` (`updated_at`),
    KEY `idx_content_cat_is_dele_bf1cd7` (`is_deleted`),
    KEY `idx_content_cat_order_33bc7e` (`order`),
    KEY `idx_content_cat_parent__5568e2` (`parent_id`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `content_list` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `title` VARCHAR(255) NOT NULL  COMMENT '标题',
    `order` INT NOT NULL  COMMENT '排序' DEFAULT 0,
    `type` INT NOT NULL  COMMENT '类型1图文2视频' DEFAULT 1,
    `cover` VARCHAR(255) NOT NULL  COMMENT '封面',
    `tags` JSON   COMMENT '标签',
    `desc` LONGTEXT   COMMENT '备注',
    `files` JSON   COMMENT '多文件',
    `go_type` INT NOT NULL  COMMENT '跳转类型' DEFAULT 0,
    `go_url` VARCHAR(255)   COMMENT '跳转值',
    `shop_ids` VARCHAR(255) NOT NULL  COMMENT '关联商品',
    `state` BOOL NOT NULL  COMMENT '是否激活' DEFAULT 1,
    `parent_id` BIGINT COMMENT '分类id',
    CONSTRAINT `fk_content__content__50dd97b1` FOREIGN KEY (`parent_id`) REFERENCES `content_category` (`id`) ON DELETE NO ACTION,
    KEY `idx_content_lis_created_550541` (`created_at`),
    KEY `idx_content_lis_updated_7db611` (`updated_at`),
    KEY `idx_content_lis_type_fabd7c` (`type`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `marketing_coupons` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `coupons_id` INT NOT NULL  COMMENT '优惠券ID' DEFAULT 0,
    `coupons_price` INT NOT NULL  COMMENT '面额' DEFAULT 0,
    `expire_at` DATETIME(6)   COMMENT '过期时间',
    `is_used` INT NOT NULL  COMMENT '0未使用1已使用' DEFAULT 0,
    `order_id` INT   COMMENT '使用的订单ID' DEFAULT 0,
    `add_order_id` INT   COMMENT '生成的订单ID' DEFAULT 0,
    `order_goods_id` INT   COMMENT '订单商品表id',
    `remark` VARCHAR(255)   COMMENT '备注',
    `come_type` INT   COMMENT '获得方式1手动发放2商品3抽奖' DEFAULT 1,
    KEY `idx_marketing_c_created_74fba2` (`created_at`),
    KEY `idx_marketing_c_updated_4ccf82` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `marketing_coupons_role` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(255)   COMMENT '优惠券名称',
    `cover` VARCHAR(255)   COMMENT '封面',
    `value` INT   COMMENT '面额' DEFAULT 0,
    `goods_ids` JSON   COMMENT '可使用商品',
    `role` INT   COMMENT '使用起点' DEFAULT 0,
    `expire_at` INT   COMMENT '过期天数' DEFAULT 0,
    `remark` VARCHAR(255)   COMMENT '备注',
    `state` BOOL NOT NULL  COMMENT '是否激活' DEFAULT 1,
    KEY `idx_marketing_c_created_006b79` (`created_at`),
    KEY `idx_marketing_c_updated_5fdad9` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `customer_grow` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(20)   COMMENT '模板名称',
    `type` INT NOT NULL  COMMENT '1固定比例，固定金额' DEFAULT 1,
    `routers` JSON   COMMENT '模板规则json',
    KEY `idx_customer_gr_created_269aa5` (`created_at`),
    KEY `idx_customer_gr_updated_711cdb` (`updated_at`),
    KEY `idx_customer_gr_name_3178ec` (`name`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `customer_level` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(20)   COMMENT '等级名称',
    `value` INT NOT NULL  COMMENT '等级值' DEFAULT 0,
    `level_integral` INT NOT NULL  COMMENT '升级积分' DEFAULT 0,
    KEY `idx_customer_le_created_1a917b` (`created_at`),
    KEY `idx_customer_le_updated_735ed1` (`updated_at`),
    KEY `idx_customer_le_name_752471` (`name`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `customer_share` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '分享人' DEFAULT 0,
    `share_url` VARCHAR(255)   COMMENT '分享链接',
    `click_time` INT NOT NULL  COMMENT '阅读次数' DEFAULT 0,
    KEY `idx_customer_sh_created_5063bc` (`created_at`),
    KEY `idx_customer_sh_updated_084fc5` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `customer_list` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `platform` INT NOT NULL  COMMENT '平台1 小程序 2 IOS 3 Android' DEFAULT 1,
    `name` VARCHAR(20)   COMMENT '昵称',
    `alias` VARCHAR(30)   COMMENT '姓名',
    `phone` VARCHAR(20)   COMMENT '电话',
    `address` VARCHAR(20)   COMMENT '地址',
    `password` VARCHAR(128)   COMMENT '密码',
    `avatar` VARCHAR(255)   COMMENT '头像',
    `card_no` INT NOT NULL  COMMENT '卡号' DEFAULT 0,
    `birth` VARCHAR(255)   COMMENT '生日',
    `sex` INT NOT NULL  COMMENT '性别1男2女' DEFAULT 0,
    `age` INT NOT NULL  COMMENT '年龄' DEFAULT 0,
    `identity` VARCHAR(255)   COMMENT '证件号',
    `remark` LONGTEXT   COMMENT '备注',
    `is_active` BOOL NOT NULL  COMMENT '是否激活' DEFAULT 1,
    `is_user` BOOL NOT NULL  COMMENT '是否设为员工' DEFAULT 0,
    `user_id` INT NOT NULL  COMMENT '系统用户' DEFAULT 0,
    `friend_phone` VARCHAR(20)   COMMENT '挚友电话',
    `last_login` DATETIME(6)   COMMENT '最后登录时间',
    `role_id` INT NOT NULL  COMMENT '角色' DEFAULT 1,
    `open_id` VARCHAR(255)   COMMENT '微信openid',
    `money_deposit` DECIMAL(10,2) NOT NULL  COMMENT '储值金余额' DEFAULT 0,
    `money_integral` DECIMAL(10,2) NOT NULL  COMMENT '积分余额' DEFAULT 0,
    `money_coupons` DECIMAL(10,2) NOT NULL  COMMENT '优惠券余额' DEFAULT 0,
    `money_commission` DECIMAL(10,2) NOT NULL  COMMENT '佣金余额' DEFAULT 0,
    `level_integral` DECIMAL(10,2) NOT NULL  COMMENT '等级积分' DEFAULT 0,
    `tabs` LONGTEXT   COMMENT '用户标签',
    `parent_id` BIGINT,
    CONSTRAINT `fk_customer_customer_ee618a8d` FOREIGN KEY (`parent_id`) REFERENCES `customer_list` (`id`) ON DELETE NO ACTION,
    KEY `idx_customer_li_created_caf27d` (`created_at`),
    KEY `idx_customer_li_updated_5f7829` (`updated_at`),
    KEY `idx_customer_li_phone_861ade` (`phone`),
    KEY `idx_customer_li_card_no_f61ea2` (`card_no`),
    KEY `idx_customer_li_friend__756250` (`friend_phone`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `customer_visit` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `customer_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `plan_id` INT NOT NULL  COMMENT '回访计划id' DEFAULT 0,
    `add_uid` INT NOT NULL  COMMENT '添加人id' DEFAULT 0,
    `remark` VARCHAR(255)   COMMENT '回访备注',
    `remark_images` JSON   COMMENT '回访照片上传',
    KEY `idx_customer_vi_created_7ea8c7` (`created_at`),
    KEY `idx_customer_vi_updated_cf57ae` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `marketing_deposit` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `price` DECIMAL(10,2) NOT NULL  COMMENT '变动金额',
    `direction` INT NOT NULL  COMMENT '变动方向1增加2减少' DEFAULT 1,
    `order_id` INT   COMMENT '订单id',
    `order_goods_id` INT   COMMENT '订单商品表id',
    `goods_id` INT   COMMENT '商品id',
    `goods_num` INT   COMMENT '购买数量',
    `remark` VARCHAR(255)   COMMENT '备注',
    `zs_price` DECIMAL(10,2) NOT NULL  COMMENT '赠送金额' DEFAULT 0,
    KEY `idx_marketing_d_created_ee8672` (`created_at`),
    KEY `idx_marketing_d_updated_fb498f` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `admin_dept` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(20) NOT NULL UNIQUE COMMENT '部门名称',
    `desc` VARCHAR(500)   COMMENT '备注',
    `is_deleted` BOOL NOT NULL  COMMENT '软删除标记' DEFAULT 0,
    `order` INT NOT NULL  COMMENT '排序' DEFAULT 0,
    `parent_id` INT NOT NULL  COMMENT '父部门ID' DEFAULT 0,
    KEY `idx_admin_dept_created_3431cb` (`created_at`),
    KEY `idx_admin_dept_updated_18af7a` (`updated_at`),
    KEY `idx_admin_dept_name_2e143c` (`name`),
    KEY `idx_admin_dept_is_dele_4b618a` (`is_deleted`),
    KEY `idx_admin_dept_order_045892` (`order`),
    KEY `idx_admin_dept_parent__a3942f` (`parent_id`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `admin_dept_closure` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `ancestor` INT NOT NULL  COMMENT '父代',
    `descendant` INT NOT NULL  COMMENT '子代',
    `level` INT NOT NULL  COMMENT '深度' DEFAULT 0,
    KEY `idx_admin_dept__created_4f1a78` (`created_at`),
    KEY `idx_admin_dept__updated_851f06` (`updated_at`),
    KEY `idx_admin_dept__ancesto_5dc444` (`ancestor`),
    KEY `idx_admin_dept__descend_5fc68b` (`descendant`),
    KEY `idx_admin_dept__level_25c2a6` (`level`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `admin_downloads` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(255) NOT NULL  COMMENT '文件名称',
    `state` INT NOT NULL  COMMENT '下载状态' DEFAULT 0,
    `user_id` INT NOT NULL  COMMENT '生成人ID' DEFAULT 0,
    `url` VARCHAR(255) NOT NULL  COMMENT '下载路径',
    `count` INT NOT NULL  COMMENT '下载次数' DEFAULT 0,
    KEY `idx_admin_downl_created_53f56d` (`created_at`),
    KEY `idx_admin_downl_updated_5675bd` (`updated_at`),
    KEY `idx_admin_downl_user_id_d5b9fe` (`user_id`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `marketing_draw` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `is_got` INT NOT NULL  COMMENT '是否中奖1中奖' DEFAULT 0,
    `draw_id` INT NOT NULL  COMMENT '奖品id' DEFAULT 0,
    `order_id` INT   COMMENT '订单id' DEFAULT 0,
    `status` INT NOT NULL  COMMENT '0未兑奖1已兑奖' DEFAULT 0,
    `up_time` DATETIME(6)   COMMENT '兑奖时间',
    KEY `idx_marketing_d_created_198cda` (`created_at`),
    KEY `idx_marketing_d_updated_b7261e` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `marketing_draw_role` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(255) NOT NULL  COMMENT '奖品名称',
    `type` INT   COMMENT '奖品类型0未中奖1折扣2优惠券3商品4积分' DEFAULT 0,
    `type_id` INT   COMMENT '关联id' DEFAULT 0,
    `cover` VARCHAR(255)   COMMENT '封面',
    `value` INT   COMMENT '总数量' DEFAULT 0,
    `role` INT   COMMENT '中奖概率' DEFAULT 0,
    `remark` VARCHAR(255)   COMMENT '备注',
    `state` BOOL NOT NULL  COMMENT '是否激活' DEFAULT 1,
    KEY `idx_marketing_d_created_e97e6d` (`created_at`),
    KEY `idx_marketing_d_updated_d32277` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `exam_list` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `title` VARCHAR(255) NOT NULL  COMMENT '试卷标题',
    `cover` VARCHAR(255) NOT NULL  COMMENT '封面',
    `desc` LONGTEXT   COMMENT '备注',
    `state` BOOL NOT NULL  COMMENT '是否激活' DEFAULT 1,
    `questions` JSON   COMMENT '选项',
    KEY `idx_exam_list_created_2cf807` (`created_at`),
    KEY `idx_exam_list_updated_06f590` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `goods_list` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(200)   COMMENT '商品名称',
    `name_small` VARCHAR(200)   COMMENT '副标题',
    `tags` JSON   COMMENT '标签',
    `brand_id` INT   COMMENT '品牌ID' DEFAULT 0,
    `cover` VARCHAR(255)   COMMENT '封面',
    `banners` JSON   COMMENT '轮播图',
    `contents` JSON   COMMENT '详情页图',
    `category_id` INT NOT NULL  COMMENT '类目ID' DEFAULT 0,
    `info_goods` JSON   COMMENT '产品信息',
    `info_after` JSON   COMMENT '发货售后信息',
    `sku` JSON   COMMENT 'sku数据',
    `is_level` INT   COMMENT '是否升级礼包' DEFAULT 0,
    `is_level_type` INT   COMMENT '升级的等级' DEFAULT 0,
    `is_hot` INT   COMMENT '是否预热商品' DEFAULT 0,
    `is_hot_date` DATETIME(6)   COMMENT '开售时间',
    `is_on` INT   COMMENT '商品定时上架' DEFAULT 0,
    `is_on_date` DATETIME(6)   COMMENT '商品定时上架时间',
    `is_off` INT   COMMENT '商品定时下架' DEFAULT 0,
    `is_off_date` DATETIME(6)   COMMENT '商品定时下架时间',
    `is_buy` INT   COMMENT '限购设置' DEFAULT 0,
    `is_buy_days` INT   COMMENT '多少天内限购' DEFAULT 0,
    `is_buy_nums` INT   COMMENT '多少件' DEFAULT 0,
    `is_low` INT   COMMENT '最低起购设置' DEFAULT 0,
    `is_low_nums` INT   COMMENT '最低起购多少件' DEFAULT 0,
    `is_buy_level` INT   COMMENT '限制购买等级' DEFAULT 0,
    `is_buy_level_roles` JSON   COMMENT '限制购买等级,多选',
    `is_read` INT   COMMENT '限制可见等级' DEFAULT 0,
    `is_read_roles` JSON   COMMENT '限制购买等级,多选',
    `is_select_user` INT   COMMENT '指定用户可见可购买' DEFAULT 0,
    `is_select_user_users` JSON   COMMENT '限制购买等级,多选',
    `is_share` INT   COMMENT '商品禁止分享' DEFAULT 0,
    `is_seven_day` INT   COMMENT '支持7天无理由' DEFAULT 0,
    `grow_id` INT   COMMENT '培育ID' DEFAULT 0,
    `order` INT   COMMENT '排序' DEFAULT 0,
    `desc` VARCHAR(500)   COMMENT '备注',
    `state` BOOL NOT NULL  COMMENT '0下架1上架中' DEFAULT 1,
    `express_id` INT   COMMENT '运费ID' DEFAULT 0,
    `contact_goods` JSON   COMMENT '关联商品',
    `get_deposit` INT   COMMENT '获得储值金' DEFAULT 0,
    `get_deposit_max` INT   COMMENT '最高获得储值金' DEFAULT 0,
    `get_integral` INT   COMMENT '获得积分' DEFAULT 0,
    `get_coupons` INT   COMMENT '获得优惠券id' DEFAULT 0,
    `type` INT   COMMENT '商品类型1项目2产品3储值4套餐卡' DEFAULT 1,
    `is_buckling` INT   COMMENT '是否需要划扣' DEFAULT 0,
    `get_level_integral` INT   COMMENT '获得成长积分' DEFAULT 0,
    `giver_integral` INT   COMMENT '赠送者获得积分' DEFAULT 0,
    `giver_level_integral` INT   COMMENT '赠送者获得成长积分' DEFAULT 0,
    `giver_coupons` INT   COMMENT '赠送者获得优惠券id' DEFAULT 0,
    `giver_deposit_max` INT   COMMENT '赠送者最高获得储值金' DEFAULT 0,
    `goods_id` INT   COMMENT '获得商品id' DEFAULT 0,
    `sku_id` INT   COMMENT '获得规格' DEFAULT 0,
    `giver_goods_id` INT   COMMENT '赠送者获得商品id' DEFAULT 0,
    `giver_sku_id` INT   COMMENT '赠送者获得规格' DEFAULT 0,
    `rebate` INT   COMMENT '提成发放方式 1购买2开卡' DEFAULT 0,
    `input_cps` DECIMAL(10,2) NOT NULL  COMMENT '录入人提成',
    `operate_cps` DECIMAL(10,2) NOT NULL  COMMENT '技师提成',
    KEY `idx_goods_list_created_639c4b` (`created_at`),
    KEY `idx_goods_list_updated_cf9543` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `goods_attribute` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(255)   COMMENT '属性名称',
    `type` INT NOT NULL  COMMENT '属性类型1规则属性2描述属性' DEFAULT 1,
    `tags` JSON   COMMENT '属性值',
    KEY `idx_goods_attri_created_02c9d2` (`created_at`),
    KEY `idx_goods_attri_updated_b5dc6d` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `goods_brand` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(255)   COMMENT '品牌名称',
    `name_english` VARCHAR(255)   COMMENT '品牌英文名称',
    `cover` VARCHAR(255)   COMMENT '封面',
    `logo_image` VARCHAR(255)   COMMENT 'logo图',
    `share_image` VARCHAR(255)   COMMENT '分享图',
    `desc` VARCHAR(255)   COMMENT '介绍',
    `topic_id` INT NOT NULL  COMMENT '关联专题页id' DEFAULT 0,
    KEY `idx_goods_brand_created_322662` (`created_at`),
    KEY `idx_goods_brand_updated_044402` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `goods_category` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(255)   COMMENT '分类名称',
    `desc` VARCHAR(500)   COMMENT '备注',
    `is_deleted` BOOL NOT NULL  COMMENT '软删除标记' DEFAULT 0,
    `order` INT NOT NULL  COMMENT '排序' DEFAULT 0,
    `parent_id` INT NOT NULL  COMMENT '父分类ID' DEFAULT 0,
    `attribute_ms_id` JSON   COMMENT '描述属性ID',
    `attribute_gg_id` JSON   COMMENT '规格属性ID',
    `cover` VARCHAR(255)   COMMENT '分类封面',
    `banner` VARCHAR(255)   COMMENT '分类banner',
    KEY `idx_goods_categ_created_e0e576` (`created_at`),
    KEY `idx_goods_categ_updated_1d8688` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `goods_express` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(255)   COMMENT '模板名称',
    `type` INT NOT NULL  COMMENT '计价方式1按件数2按重量' DEFAULT 1,
    `roles` JSON   COMMENT '区域运费规则',
    `stop_roles` JSON   COMMENT '停发区域',
    KEY `idx_goods_expre_created_9ca225` (`created_at`),
    KEY `idx_goods_expre_updated_6fe10f` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `goods_group` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(255)   COMMENT '组合包名称',
    `type` INT NOT NULL  COMMENT '类型1分次2总次3时段' DEFAULT 1,
    `times` INT NOT NULL  COMMENT '总次数/总天数' DEFAULT 0,
    `goods` JSON   COMMENT '组合包商品',
    `goods_id` INT NOT NULL  COMMENT '商品的id' DEFAULT 0,
    `sku_id` INT NOT NULL  COMMENT 'sku的id' DEFAULT 0,
    `type2` INT NOT NULL  COMMENT '1必得2可选' DEFAULT 1,
    KEY `idx_goods_group_created_f659ff` (`created_at`),
    KEY `idx_goods_group_updated_59f602` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `goods_sku` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `goods_id` INT NOT NULL  COMMENT '商品id' DEFAULT 0,
    `sku_name` VARCHAR(255)   COMMENT 'sku名称',
    `sku_kc` INT NOT NULL  COMMENT '库存' DEFAULT 1,
    `sku_cover` JSON   COMMENT '封面',
    `sku_level` JSON   COMMENT '各个等级的价格',
    `can_do` INT NOT NULL  COMMENT '可以使用的次数' DEFAULT 1,
    `include` JSON   COMMENT '包含套餐',
    KEY `idx_goods_sku_created_e5327e` (`created_at`),
    KEY `idx_goods_sku_updated_4c5422` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `marketing_integral` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `price` DECIMAL(10,2) NOT NULL  COMMENT '变动金额',
    `direction` INT   COMMENT '变动方向1增加2减少' DEFAULT 1,
    `type` INT   COMMENT '积分类型' DEFAULT 0,
    `type_id` INT   COMMENT '类型值' DEFAULT 0,
    `expire_at` DATETIME(6)   COMMENT '过期时间',
    `remark` VARCHAR(255)   COMMENT '备注',
    KEY `idx_marketing_i_created_3fc21e` (`created_at`),
    KEY `idx_marketing_i_updated_5953fe` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `marketing_integral_role` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(255) NOT NULL  COMMENT '名称',
    `value` INT   COMMENT '收益用户id' DEFAULT 0,
    `role` VARCHAR(255)   COMMENT '规则',
    `remark` VARCHAR(255)   COMMENT '备注',
    `state` BOOL   COMMENT '是否激活' DEFAULT 1,
    KEY `idx_marketing_i_created_9c6264` (`created_at`),
    KEY `idx_marketing_i_updated_7ff8bc` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `jobs_log` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '关联人id' DEFAULT 0,
    `job_id` INT NOT NULL  COMMENT '任务id' DEFAULT 0,
    `result_status` INT   COMMENT '执行结果1成功2失败' DEFAULT 0,
    `result_data` LONGTEXT   COMMENT '执行返回数据',
    KEY `idx_jobs_log_created_8a28b6` (`created_at`),
    KEY `idx_jobs_log_updated_18664d` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `jobs_rule` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `type` INT NOT NULL  COMMENT '任务类型' DEFAULT 1,
    `name` VARCHAR(255) NOT NULL  COMMENT '任务标题',
    `func_name` VARCHAR(255) NOT NULL  COMMENT '访问url',
    `times` INT   COMMENT '执行间隔(秒)' DEFAULT 0,
    `day` INT   COMMENT '天' DEFAULT 0,
    `hour` INT   COMMENT '时' DEFAULT 0,
    `minute` INT   COMMENT '分' DEFAULT 0,
    `second` INT   COMMENT '秒' DEFAULT 0,
    `state` BOOL NOT NULL  COMMENT '执行状态' DEFAULT 0,
    `up_type` INT   COMMENT '启动方式1自启动2手动启动' DEFAULT 1,
    KEY `idx_jobs_rule_created_7934c8` (`created_at`),
    KEY `idx_jobs_rule_updated_db7ced` (`updated_at`),
    KEY `idx_jobs_rule_type_fcec96` (`type`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `marketing_level_integral` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `price` DECIMAL(10,2) NOT NULL  COMMENT '变动数量',
    `direction` INT   COMMENT '变动方向1增加2减少' DEFAULT 1,
    `remark` VARCHAR(255)   COMMENT '备注',
    `order_id` INT   COMMENT '类型id或者订单id' DEFAULT 0,
    KEY `idx_marketing_l_created_600bfb` (`created_at`),
    KEY `idx_marketing_l_updated_a6187a` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `marketing_lives` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(255)   COMMENT '直播名称',
    `cover` VARCHAR(255)   COMMENT '直播间封面',
    `button_image` VARCHAR(255)   COMMENT '进入按钮',
    `share_image` VARCHAR(255)   COMMENT '分享图',
    `goods_ids` JSON   COMMENT '直播统计商品',
    `begin_time` DATETIME(6)   COMMENT '直播开始时间',
    `state` BOOL NOT NULL  COMMENT '是否激活' DEFAULT 1,
    KEY `idx_marketing_l_created_718c61` (`created_at`),
    KEY `idx_marketing_l_updated_425a2c` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `admin_menu` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(20) NOT NULL  COMMENT '菜单名称',
    `remark` JSON   COMMENT '保留字段',
    `menu_type` VARCHAR(7)   COMMENT '菜单类型',
    `icon` VARCHAR(100)   COMMENT '菜单图标',
    `path` VARCHAR(100) NOT NULL  COMMENT '菜单路径',
    `order` INT NOT NULL  COMMENT '排序' DEFAULT 0,
    `parent_id` INT NOT NULL  COMMENT '父菜单ID' DEFAULT 0,
    `is_hidden` BOOL NOT NULL  COMMENT '是否隐藏' DEFAULT 0,
    `component` VARCHAR(100) NOT NULL  COMMENT '组件',
    `keepalive` BOOL NOT NULL  COMMENT '存活' DEFAULT 1,
    `redirect` VARCHAR(100)   COMMENT '重定向',
    KEY `idx_admin_menu_created_95f056` (`created_at`),
    KEY `idx_admin_menu_updated_41a534` (`updated_at`),
    KEY `idx_admin_menu_name_38edba` (`name`),
    KEY `idx_admin_menu_path_136a39` (`path`),
    KEY `idx_admin_menu_order_1db47a` (`order`),
    KEY `idx_admin_menu_parent__2227d9` (`parent_id`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `mini_alert` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `order` INT NOT NULL  COMMENT '排序' DEFAULT 0,
    `name` VARCHAR(20) NOT NULL  COMMENT '弹屏名称',
    `cover` VARCHAR(255)   COMMENT '封面',
    `start_time` DATETIME(6)   COMMENT '开始时间',
    `end_time` DATETIME(6)   COMMENT '结束时间',
    `go_type` INT   COMMENT '跳转类型' DEFAULT 0,
    `go_url` VARCHAR(255)   COMMENT '跳转值',
    `is_active` BOOL NOT NULL  COMMENT '是否激活' DEFAULT 1,
    KEY `idx_mini_alert_created_6298c4` (`created_at`),
    KEY `idx_mini_alert_updated_bdde46` (`updated_at`),
    KEY `idx_mini_alert_name_83d7a7` (`name`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `mini_auditlog` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户ID',
    `username` VARCHAR(64) NOT NULL  COMMENT '用户名称' DEFAULT '',
    `module` VARCHAR(64) NOT NULL  COMMENT '功能模块' DEFAULT '',
    `summary` VARCHAR(128) NOT NULL  COMMENT '请求描述' DEFAULT '',
    `method` VARCHAR(10) NOT NULL  COMMENT '请求方法' DEFAULT '',
    `path` VARCHAR(255) NOT NULL  COMMENT '请求路径' DEFAULT '',
    `status` INT NOT NULL  COMMENT '状态码' DEFAULT -1,
    `response_time` INT NOT NULL  COMMENT '响应时间(单位ms)' DEFAULT 0,
    `datas` JSON   COMMENT '提交数据',
    KEY `idx_mini_auditl_created_eba610` (`created_at`),
    KEY `idx_mini_auditl_updated_d49ad0` (`updated_at`),
    KEY `idx_mini_auditl_user_id_c3c12c` (`user_id`),
    KEY `idx_mini_auditl_usernam_cbbfd6` (`username`),
    KEY `idx_mini_auditl_module_45f21b` (`module`),
    KEY `idx_mini_auditl_summary_082252` (`summary`),
    KEY `idx_mini_auditl_method_962058` (`method`),
    KEY `idx_mini_auditl_path_4fb50e` (`path`),
    KEY `idx_mini_auditl_status_70ec37` (`status`),
    KEY `idx_mini_auditl_respons_d99bbf` (`response_time`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `mini_comment` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `type` INT   COMMENT '1商品2圈层' DEFAULT 0,
    `type_id` INT NOT NULL  COMMENT '类型值' DEFAULT 0,
    `content` VARCHAR(255)   COMMENT '评论内容' DEFAULT '',
    `comment_id` INT NOT NULL  COMMENT '被引用的id' DEFAULT 0,
    `praise_count` INT NOT NULL  COMMENT '点赞数' DEFAULT 0,
    `status` INT NOT NULL  COMMENT '0待确认1通过2不通过' DEFAULT 0,
    KEY `idx_mini_commen_created_1a6642` (`created_at`),
    KEY `idx_mini_commen_updated_7aec81` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `mini_fav` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `type` INT   COMMENT '1商品2圈层' DEFAULT 0,
    `type_id` INT NOT NULL  COMMENT '类型值' DEFAULT 0,
    KEY `idx_mini_fav_created_9a5921` (`created_at`),
    KEY `idx_mini_fav_updated_a86130` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `mini_layers` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户ID',
    `title` VARCHAR(255)   COMMENT '标题' DEFAULT '',
    `content` VARCHAR(255)   COMMENT '内容' DEFAULT '',
    `images` JSON   COMMENT '多图',
    `praise_count` INT NOT NULL  COMMENT '点赞数' DEFAULT 0,
    `review_count` INT NOT NULL  COMMENT '评论数' DEFAULT 0,
    `collect_count` INT NOT NULL  COMMENT '收藏数' DEFAULT 0,
    `comment_at` DATETIME(6)   COMMENT '最新评论时间',
    `status` INT NOT NULL  COMMENT '0待确认1通过2不通过' DEFAULT 0,
    KEY `idx_mini_layers_created_821a6e` (`created_at`),
    KEY `idx_mini_layers_updated_8d05c5` (`updated_at`),
    KEY `idx_mini_layers_user_id_4e04e9` (`user_id`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `mini_like` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `type` INT   COMMENT '1商品2圈层' DEFAULT 0,
    `type_id` INT NOT NULL  COMMENT '类型值' DEFAULT 0,
    KEY `idx_mini_like_created_49109d` (`created_at`),
    KEY `idx_mini_like_updated_d27537` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `mini_settings` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(20) NOT NULL  COMMENT '配置名称',
    `set_value` VARCHAR(20)   COMMENT '配置值',
    `is_active` BOOL NOT NULL  COMMENT '是否激活' DEFAULT 1,
    KEY `idx_mini_settin_created_d08d0a` (`created_at`),
    KEY `idx_mini_settin_updated_0f163f` (`updated_at`),
    KEY `idx_mini_settin_name_e44a1a` (`name`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `mini_topic` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `order` INT NOT NULL  COMMENT '排序' DEFAULT 0,
    `name` VARCHAR(20) NOT NULL  COMMENT '专题名称',
    `content` JSON   COMMENT '专题配置',
    `is_active` BOOL NOT NULL  COMMENT '是否激活' DEFAULT 1,
    KEY `idx_mini_topic_created_facb14` (`created_at`),
    KEY `idx_mini_topic_updated_c05f06` (`updated_at`),
    KEY `idx_mini_topic_name_d78f6d` (`name`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `admin_notices` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `title` VARCHAR(255) NOT NULL  COMMENT '名称',
    `type` INT NOT NULL  COMMENT '通知类型' DEFAULT 0,
    `user_id` INT NOT NULL  COMMENT '通知人ID' DEFAULT 0,
    `status` INT NOT NULL  COMMENT '状态0未处理1已处理' DEFAULT 0,
    `go_path` VARCHAR(255) NOT NULL  COMMENT '跳转路由',
    KEY `idx_admin_notic_created_61fa8d` (`created_at`),
    KEY `idx_admin_notic_updated_afa1d5` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `orders_car` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `goods_id` INT NOT NULL  COMMENT '商品id' DEFAULT 0,
    `price` DECIMAL(10,2) NOT NULL  COMMENT '商品单价',
    `sku_id` INT NOT NULL  COMMENT 'ske的id' DEFAULT 0,
    `sku_name` VARCHAR(255)   COMMENT '规格名称',
    `sale_price` DECIMAL(10,2) NOT NULL  COMMENT '优惠金额',
    `num` INT NOT NULL  COMMENT '商品数量' DEFAULT 1,
    KEY `idx_orders_car_created_3ca86d` (`created_at`),
    KEY `idx_orders_car_updated_b5bd32` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `orders_express` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `order_id` INT NOT NULL  COMMENT 'OrdersList的id' DEFAULT 0,
    `order_goods_id` JSON   COMMENT 'OrdersGoods的id',
    `express_company` VARCHAR(255)   COMMENT '物流公司',
    `express_no` VARCHAR(255)   COMMENT '物流单号',
    KEY `idx_orders_expr_created_355f3e` (`created_at`),
    KEY `idx_orders_expr_updated_2a97b0` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `orders_goods` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `order_id` INT NOT NULL  COMMENT '订单id' DEFAULT 0,
    `goods_id` INT NOT NULL  COMMENT '商品id' DEFAULT 0,
    `sku_id` INT NOT NULL  COMMENT 'sku_id' DEFAULT 0,
    `price` DECIMAL(10,2) NOT NULL  COMMENT '商品单价',
    `sku_name` VARCHAR(255)   COMMENT '规格名称',
    `sale_price` DECIMAL(10,2) NOT NULL  COMMENT '优惠金额',
    `sale_roles` JSON   COMMENT '优惠规则',
    `num` INT NOT NULL  COMMENT '商品数量' DEFAULT 1,
    `status` INT NOT NULL  COMMENT '0待支付,1已支付,2已取消,3已退款' DEFAULT 0,
    `is_express` INT NOT NULL  COMMENT '0待发货,1已发货' DEFAULT 0,
    `express_company` VARCHAR(255)   COMMENT '物流公司',
    `express_no` VARCHAR(255)   COMMENT '物流单号',
    `remark` JSON   COMMENT '下单备注',
    `attr` JSON   COMMENT '点单加料1',
    `give_type` INT NOT NULL  COMMENT '0普通1赠送给自己2赠送给推荐人' DEFAULT 0,
    KEY `idx_orders_good_created_62ac45` (`created_at`),
    KEY `idx_orders_good_updated_369ae1` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `orders_list` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `water_no` VARCHAR(255)   COMMENT '流水号',
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `type` INT NOT NULL  COMMENT '订单类型1点单2商城' DEFAULT 1,
    `price` DECIMAL(10,2) NOT NULL  COMMENT '订单总金额',
    `amount_price` DECIMAL(10,2) NOT NULL  COMMENT '实际支付',
    `sale_price` DECIMAL(10,2) NOT NULL  COMMENT '优惠金额',
    `sale_roles` JSON   COMMENT '优惠规则',
    `status` INT NOT NULL  COMMENT '0待支付,1已支付,2已取消,3已退款' DEFAULT 0,
    `pay_time` DATETIME(6)   COMMENT '付款时间',
    `exp_time` DATETIME(6)   COMMENT '支付超时时间',
    `is_express` INT NOT NULL  COMMENT '0待发货,2部分发货,1已发货' DEFAULT 0,
    `express` JSON   COMMENT '物流状态',
    `express_price` DECIMAL(10,2) NOT NULL  COMMENT '运费',
    `receive_name` VARCHAR(255)   COMMENT '收件人',
    `receive_phone` VARCHAR(255)   COMMENT '收件电话',
    `receive_address` VARCHAR(255)   COMMENT '收件地址',
    `goods` JSON   COMMENT '商品详情',
    `remark` VARCHAR(255)   COMMENT '订单备注',
    `address_id` INT   COMMENT '门店id' DEFAULT 0,
    `is_give` INT   COMMENT '是否赠送0否1是' DEFAULT 0,
    `giver_id` INT   COMMENT '赠送人id' DEFAULT 0,
    `is_deposit` INT   COMMENT '是否储值金购买' DEFAULT 0,
    `deposit_price` DECIMAL(10,2) NOT NULL  COMMENT '储值金支付金额',
    `coupons` JSON   COMMENT '优惠券ids',
    `coupons_price` DECIMAL(10,2) NOT NULL  COMMENT '优惠券支付金额',
    `refund_time` DATETIME(6)   COMMENT '退款时间',
    `is_draw` INT   COMMENT '是否可以抽奖0不可1可以' DEFAULT 0,
    `draw_id` INT   COMMENT '抽奖记录ID' DEFAULT 0,
    `add_uid` INT   COMMENT '后端录入人id' DEFAULT 0,
    `order_rate` INT   COMMENT '评价星级' DEFAULT 5,
    `order_evaluations` VARCHAR(300)   COMMENT '订单评价(限制字数90)',
    `is_review` INT   COMMENT '是否评价' DEFAULT 0,
    KEY `idx_orders_list_created_b732bd` (`created_at`),
    KEY `idx_orders_list_updated_e89a64` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `orders_receive` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `receive_name` VARCHAR(255)   COMMENT '收件人',
    `receive_phone` VARCHAR(255)   COMMENT '收件电话',
    `receive_city` VARCHAR(255)   COMMENT '收件城市',
    `receive_address` VARCHAR(255)   COMMENT '收件地址',
    `is_default` BOOL NOT NULL  COMMENT '是否默认' DEFAULT 1,
    KEY `idx_orders_rece_created_653770` (`created_at`),
    KEY `idx_orders_rece_updated_b2a71a` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `orders_water` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `order_id` INT NOT NULL  COMMENT '订单id' DEFAULT 0,
    `amount` DECIMAL(10,2) NOT NULL  COMMENT '微信支付金额',
    `out_trade_no` VARCHAR(255)   COMMENT '商户订单号',
    `transaction_id` VARCHAR(255)   COMMENT '微信支付流水号',
    `success_time` DATETIME(6)   COMMENT '支付成功时间',
    KEY `idx_orders_wate_created_6f7e6f` (`created_at`),
    KEY `idx_orders_wate_updated_0159f6` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `saas_performance_percentage` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `order_id` INT NOT NULL  COMMENT '订单id' DEFAULT 0,
    `goods_id` INT NOT NULL  COMMENT '商品id' DEFAULT 0,
    `sku_id` INT NOT NULL  COMMENT 'sku_id' DEFAULT 0,
    `customer_id` INT NOT NULL  COMMENT '客户id' DEFAULT 0,
    `user_id` INT NOT NULL  COMMENT '员工id' DEFAULT 0,
    `space_id` INT NOT NULL  COMMENT '门店id' DEFAULT 0,
    `price` DECIMAL(10,2) NOT NULL  COMMENT '业绩金额',
    `buckling_id` INT NOT NULL  COMMENT '待划扣id' DEFAULT 0,
    `status` INT NOT NULL  COMMENT '审核状态' DEFAULT 0,
    KEY `idx_saas_perfor_created_5fe80f` (`created_at`),
    KEY `idx_saas_perfor_updated_8fc9cc` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `exam_question` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `exam_id` INT NOT NULL  COMMENT '试卷id' DEFAULT 0,
    `question` LONGTEXT   COMMENT '问题',
    `selects` JSON   COMMENT '选项',
    `answer` JSON   COMMENT '答案',
    KEY `idx_exam_questi_created_cf4086` (`created_at`),
    KEY `idx_exam_questi_updated_14c13e` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `exam_result` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `exam_id` INT NOT NULL  COMMENT '试卷id' DEFAULT 0,
    `name` VARCHAR(255) NOT NULL  COMMENT '名称',
    `rate` VARCHAR(255) NOT NULL  COMMENT '比例',
    `score_min` INT NOT NULL  COMMENT '分数区间最小值' DEFAULT 0,
    `score_max` INT NOT NULL  COMMENT '分数区间最大值' DEFAULT 100,
    `url_type` INT NOT NULL  COMMENT '跳转类型' DEFAULT 0,
    `url` VARCHAR(255) NOT NULL  COMMENT '跳转地址',
    `picture` JSON   COMMENT '图片地址',
    KEY `idx_exam_result_created_b979f2` (`created_at`),
    KEY `idx_exam_result_updated_761ef3` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `admin_role` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `name` VARCHAR(20) NOT NULL UNIQUE COMMENT '角色名称',
    `desc` VARCHAR(500)   COMMENT '角色描述',
    KEY `idx_admin_role_created_6ab434` (`created_at`),
    KEY `idx_admin_role_updated_89e0f6` (`updated_at`),
    KEY `idx_admin_role_name_4e4d9a` (`name`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `saas_scheduling_dates` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `rules_id` INT NOT NULL  COMMENT 'rules_id' DEFAULT 0,
    `designer_id` INT   COMMENT '技师id' DEFAULT 0,
    `date` LONGTEXT   COMMENT '日期',
    `start` LONGTEXT   COMMENT '开始时间',
    `end` LONGTEXT   COMMENT '结束时间',
    `space_id` INT NOT NULL  COMMENT '门店id' DEFAULT 0,
    KEY `idx_saas_schedu_created_3045de` (`created_at`),
    KEY `idx_saas_schedu_updated_1f60ed` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `saas_scheduling_rule` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `label` LONGTEXT   COMMENT '名称',
    `start` LONGTEXT   COMMENT '开始时间',
    `end` LONGTEXT   COMMENT '结束时间',
    `color` LONGTEXT   COMMENT '颜色1',
    KEY `idx_saas_schedu_created_709119` (`created_at`),
    KEY `idx_saas_schedu_updated_a930ce` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `admin_user` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `username` VARCHAR(20) NOT NULL UNIQUE COMMENT '用户名称',
    `alias` VARCHAR(30)   COMMENT '姓名',
    `email` VARCHAR(255) NOT NULL UNIQUE COMMENT '邮箱',
    `phone` VARCHAR(20)   COMMENT '电话',
    `password` VARCHAR(128)   COMMENT '密码',
    `is_active` BOOL NOT NULL  COMMENT '是否激活' DEFAULT 1,
    `is_superuser` BOOL NOT NULL  COMMENT '是否为超级管理员' DEFAULT 0,
    `last_login` DATETIME(6)   COMMENT '最后登录时间',
    `dept_id` INT NOT NULL  COMMENT '部门ID',
    `avatar` VARCHAR(255)   COMMENT '头像',
    `salary` INT   COMMENT '底薪' DEFAULT 0,
    `space_id` INT   COMMENT '门店id' DEFAULT 0,
    KEY `idx_admin_user_created_8b5146` (`created_at`),
    KEY `idx_admin_user_updated_fca352` (`updated_at`),
    KEY `idx_admin_user_usernam_46688a` (`username`),
    KEY `idx_admin_user_alias_71bbf2` (`alias`),
    KEY `idx_admin_user_email_5c5886` (`email`),
    KEY `idx_admin_user_phone_e01cb2` (`phone`),
    KEY `idx_admin_user_is_acti_c1acc4` (`is_active`),
    KEY `idx_admin_user_is_supe_a37fe8` (`is_superuser`),
    KEY `idx_admin_user_last_lo_f35531` (`last_login`),
    KEY `idx_admin_user_dept_id_182871` (`dept_id`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `exam_answer` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '用户id' DEFAULT 0,
    `exam_id` INT NOT NULL  COMMENT '试卷id' DEFAULT 0,
    `user_answer` JSON   COMMENT '用户答案',
    `user_score` INT NOT NULL  COMMENT '用户得分' DEFAULT 0,
    `result_name` VARCHAR(255) NOT NULL  COMMENT '结果名称',
    KEY `idx_exam_answer_created_9d68c3` (`created_at`),
    KEY `idx_exam_answer_updated_6e40ee` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `saas_user_log` (
    `id` BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `created_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6),
    `updated_at` DATETIME(6) NOT NULL  DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `deleted_at` DATETIME(6),
    `user_id` INT NOT NULL  COMMENT '员工小程序用户id' DEFAULT 0,
    `data` LONGTEXT NOT NULL  COMMENT '记录值',
    KEY `idx_saas_user_l_created_faf650` (`created_at`),
    KEY `idx_saas_user_l_updated_0220b1` (`updated_at`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `aerich` (
    `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `version` VARCHAR(255) NOT NULL,
    `app` VARCHAR(100) NOT NULL,
    `content` JSON NOT NULL
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `admin_role_admin_menu` (
    `admin_role_id` BIGINT NOT NULL,
    `menu_id` BIGINT NOT NULL,
    FOREIGN KEY (`admin_role_id`) REFERENCES `admin_role` (`id`) ON DELETE CASCADE,
    FOREIGN KEY (`menu_id`) REFERENCES `admin_menu` (`id`) ON DELETE CASCADE,
    UNIQUE KEY `uidx_admin_role__admin_r_0ecb44` (`admin_role_id`, `menu_id`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `admin_role_admin_api` (
    `admin_role_id` BIGINT NOT NULL,
    `api_id` BIGINT NOT NULL,
    FOREIGN KEY (`admin_role_id`) REFERENCES `admin_role` (`id`) ON DELETE CASCADE,
    FOREIGN KEY (`api_id`) REFERENCES `admin_api` (`id`) ON DELETE CASCADE,
    UNIQUE KEY `uidx_admin_role__admin_r_be4986` (`admin_role_id`, `api_id`)
) CHARACTER SET utf8mb4;
CREATE TABLE IF NOT EXISTS `admin_user_admin_role` (
    `admin_user_id` BIGINT NOT NULL,
    `role_id` BIGINT NOT NULL,
    FOREIGN KEY (`admin_user_id`) REFERENCES `admin_user` (`id`) ON DELETE CASCADE,
    FOREIGN KEY (`role_id`) REFERENCES `admin_role` (`id`) ON DELETE CASCADE,
    UNIQUE KEY `uidx_admin_user__admin_u_de5a13` (`admin_user_id`, `role_id`)
) CHARACTER SET utf8mb4;"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        """
